---
title: tbls
---

import { Tab, Tabs } from "fumadocs-ui/components/tabs";

[tbls](https://github.com/k1LoW/tbls) is a CI-friendly tool for documenting a database schema.
If you're using tbls, in most cases you can automatically generate a useful ER diagram with Liam ERD. This page provides instructions and tips for generating an ER diagram in a tbls project.

## Using tbls JSON Output

First, generate a JSON schema file using tbls:

```bash
tbls out -t json schema.json
```

Then use Liam CLI to build an ER diagram from the JSON file:

```npm
npx @liam-hq/cli erd build --format tbls --input schema.json
```

If the command runs successfully, an ER diagram will be generated in the `dist` directory.

## Integration with CI/CD

You can integrate tbls and Liam ERD in your CI/CD pipeline to automatically generate and deploy ER diagrams. Here's an example GitHub Actions workflow:

```yaml
name: Generate ERD from tbls

on:
  push:
    branches:
      - main

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup tbls
        uses: k1low/setup-tbls@v1

      - name: Generate tbls JSON
        run: tbls out -t json schema.json

      - name: Generate ER Diagram
        run: npx @liam-hq/cli erd build --input schema.json --format tbls

      # Deploy (example using GitHub Pages)
      - name: Deploy to GitHub Pages
        uses: actions-gh-pages/action@v2
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: dist
```

For more information about CI/CD integration, see [CI/CD Integration](/docs/cli/ci-cd).

## Under the Hood

Liam ERD utilizes tbls's JSON schema output format ([schema definition](https://github.com/k1LoW/tbls/blob/main/spec/tbls.schema.json_schema.json)) to convert schemas into Liam's internal format.
